package com.plugin.manage.common;

import java.util.Date;

public enum BizCode {
    // 数据操作定义
    SUCCESS("000000", "业务成功"),
    TIME_OUT("130", "访问超时"),
    TOKEN_NULL("100401","缺少token未经授权"),
    TOKEN_ERROR("100402","token认证失败"),
    NO_PERMISSION("100403", "拒绝访问"),
    NOT_FOUND("404", "无法找到资源"),
    METHOD_NOT_ALLOWED("405", "不支持当前请求方法"),
    DUPLICATE_SUBMMIT("429", "重复提交"),
    SERVER_ERROR("500", " 系统内部错误"),
    NO_PARAM("100010", "参数不能为空"),
    NO_USERNAME_OR_PASSWORD("100101", "该用户不存在"),
    USERNAME_OR_PASSWORD_ERROR("100102", "用户名或密码错误"),
    LOGIN_USERNAME_USED("100103","用户名已存在"),
    LOGIN_MOBILE_USED("100104","手机号已存在"),
    EMAIL_USED("100105","邮箱已存在"),
    RESET_PWD_NULL("100106","重置的密码为空"),
    OPERATION_FAILURE("100107","操作失败"),
    LOCKED_AND_WAIT("100108","已锁定，请1小时后再试"),
    SESSIONID_ISNOT_SAME("100109","不是同一个会话"),
    NO_USER_ACCOUNT("100110","账户不存在"),
    NICKNAME_USED("100111","占用系统昵称"),
    BUSINESS_ERROR("111111","业务失败"),
    OTHER_ERROR("222222","其他错误"),
    ;

    /**
     * 响应码
     */
    private final String code;

    /**
     * 响应信息
     */
    private final String message;

    /**
     * 有参构造
     * @param code  响应码
     * @param message 响应信息
     */
    BizCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public String toString(){
        return "{\"code\":\""+code+"\",\"msg\":\""+message+"\",\"ret\":{},\"timestamp\":" +new Date().getTime()+"}";
    }
}
